package day19.homework;

import java.util.Map;

public class Test {
    public static void main(String[] args) {
        Cache cache = new Cache();

        Runnable readThread = () -> {
            while(true) {
                System.out.println(cache.get("C"));
                System.out.println(cache.get("D"));
            }
        };
        Runnable writeThread = () -> {
            while(true)
           cache.put(Thread.currentThread().getName() + Math.random(), "value" + Thread.currentThread().getName());
        };

        Thread t1 = new Thread(readThread, "A");
        Thread t2 = new Thread(readThread, "B");
        Thread t3 = new Thread(writeThread, "C");
        Thread t4 = new Thread(writeThread, "D");
        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }
}
